﻿using System.Text;
using System.Web.Mail;

namespace SouthernLand.Common
{
    public class SendMail
    {
        public string Body { get; set; }

        public string MailFrom { get; set; }

        public string MailServer { get; set; }

        public string MailTo { get; set; }

        public string Subject { get; set; }

        public static bool Send(SendMail objSendMail)
        {
            SmtpMail.SmtpServer = objSendMail.MailServer;
            var message = new MailMessage();
            message.To = objSendMail.MailTo;
            message.From = objSendMail.MailFrom;
            message.Subject = objSendMail.Subject;
            message.Body = objSendMail.Body;
            message.BodyFormat = MailFormat.Html;
            message.BodyEncoding = Encoding.UTF8;
            SmtpMail.Send(message);
            return true;
        }
    }
}